import { createApp } from 'vue'
import './style.css'
import './assets/style/common.scss'
import App from './App.vue'
// 引入echarts
import * as echarts from 'echarts'
// import './assets/style/resetElementTheme.scss';//自定义主题色
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// 引入样式重置插件
import 'normalize.css/normalize.css'
import 'animate.css/animate.min.css' //引入动画
// 引入路由
import router, { registerRouters } from './router'

// 引入仓库
import { createPinia } from 'pinia'
// 引入仓库的持久化存储插件
import piniaPluginPersist from 'pinia-plugin-persist'
const store = createPinia()
// 仓库使用固化工具
store.use(piniaPluginPersist)
import 'element-plus/dist/index.css'// element plus样式
import * as ElIcons from '@element-plus/icons-vue' //element plus图标
import './permission.js'

import 'virtual:uno.css'

const app = createApp(App)
app.config.globalProperties.$echarts = echarts
// 全局注册element-plus图标
for (const name in ElIcons) {
    app.component(name, (ElIcons as any)[name])
}
import buttonPremisson from './directive/buttonPremisson.js'
let adminflag: any = null
if (sessionStorage.getItem('isGrpLead') === '1' && sessionStorage.getItem('isSupPcAdmin') === '0') {
    adminflag = 1
}
if (sessionStorage.getItem('isGrpLead') === '0' && sessionStorage.getItem('isSupPcAdmin') === '1') {
    adminflag = 2
}
if (sessionStorage.getItem('isGrpLead') === '1' && sessionStorage.getItem('isSupPcAdmin') === '1') {
    adminflag = 2
}

const boot = async () => {
    // await registerRouters()
    app.config.globalProperties.roleflag = adminflag
    app.use(router).use(store).use(buttonPremisson).use(ElementPlus, { locale: zhCn }).mount('#app')
}
boot()
